package com.ytjj.qmyx.data.amqp.consumer;

import com.rabbitmq.client.Channel;
import com.ytjj.common.constants.QueueConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * amqp消息接收
 *
 */
@Component
@Slf4j
public class AmqpTestListener {

//    @Transactional(rollbackFor = Exception.class)
//    @RabbitListener(queuesToDeclare = @Queue(value = QueueConstants.TEST_QUEUE, durable = "true"))
//    public void test(Object o, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag, Channel channel) throws Exception {
//        log.info("\n\n收到一条消息deliveryTag：" + deliveryTag);
//        log.info("消息：" + o+"\n\n");
////        channel.basicAck(deliveryTag,false);            // 确认消息
//    }
}
